package com.kmt.plaza.controller;

import com.kmt.plaza.sevice.ClassifyService;
import com.kmt.plaza.sevice.ProductService;
import com.kmt.plaza.sevice.SwiperService;
import com.kmt.plaza.vo.ResultVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@CrossOrigin
@RequestMapping("/swiper")
@Api(value = "提供首页数据显示所需的接口",tags = "首页管理")
public class SwiperController {

    @Autowired
    private SwiperService swiperService;
    @Autowired
    private ClassifyService classifyService;
    @Autowired
    private ProductService productService;

    @GetMapping("/swiperImg")
    @ApiOperation(value = "首页轮播图接口")
    public ResultVO listSwipers(){
        return swiperService.listSwipers();
    }

    @GetMapping("/classifyList")
    @ApiOperation(value = "查询商品分类接口")
    public ResultVO listClassify(){
        return classifyService.listClassify();
    }


    @GetMapping("/listClassifyRecommend")
    @ApiOperation(value = "分类商品推荐接口")
    public ResultVO listRecommendProductsClassify(){
        return classifyService.listFirstLevelClassifies();
    }

    @ApiOperation("新品推存接口")
    @GetMapping("/listRecommends")
    public ResultVO listRecommendProducts(){
        return productService.listRecommendProducts();
    }
}
